<?xml version="1.0" encoding="UTF-8"?>
<ui:composition
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
	template="/WEB-INF/templates/default.xhtml"
>

	<f:metadata>
		<f:viewParam
			name="serviceBuyerId"
			value="#{serviceBuyerHome.id}"
		></f:viewParam>
		<f:event
			listener="#{serviceBuyerHome.initConversation()}"
			type="preRenderView"
		></f:event>
	</f:metadata>

	<ui:define name="head">	
		
	</ui:define>

	<ui:define name="content">
		<h:form id="editForm">
			<p:messages id="messages" />
			<p:panel id="baseInfo" style="margin-bottom:10px;"
				styleClass="nureg-cont nuregcbox nuregcboxsty">
				<h:panelGrid columns="2" cellpadding="5">

					<p:outputLabel for="cnname" value="用户名称" />
					<p:inputText id="cnname"
						value="#{serviceBuyerHome.instance.cnname}" required="true"
						 >
						<f:validator binding="#{cnnameValidator}"
							disabled="#{serviceBuyerHome.managed}"></f:validator>
						<f:ajax render="@this" />
					</p:inputText>

					<p:outputLabel for="creditCode" value="统一社会信用代码"
						rendered="#{not serviceBuyerHome.managed}"></p:outputLabel>
					<p:inputText id="creditCode"
						value="#{serviceBuyerHome.instance.creditCode}" required="true"
						rendered="#{not serviceBuyerHome.managed}"></p:inputText>

					<p:outputLabel for="email" value="邮箱"
						rendered="#{not serviceBuyerHome.managed}" />
					<p:inputText id="email" value="#{serviceBuyerHome.instance.email}"
						required="true" rendered="#{not serviceBuyerHome.managed}">
						<f:validator binding="#{emailValidator}"></f:validator>
						<f:ajax render="@this" />
					</p:inputText>

					<p:outputLabel for="legalPerson" value="法定代表人"></p:outputLabel>
					<p:inputText id="legalPerson"
						value="#{serviceBuyerHome.instance.legalPerson}" required="true"></p:inputText>

					<p:outputLabel for="legalPersonPhoneNumber" value="法人联系电话"></p:outputLabel>
					<p:inputText id="legalPersonPhoneNumber"
						value="#{serviceBuyerHome.instance.legalPersonPhoneNumber}"
						required="true"></p:inputText>

					<p:outputLabel for="firstContactor" value="第一联系人" />
					<p:inputText id="firstContactor"
						value="#{serviceBuyerHome.instance.firstContactor}"
						required="true" />
					<p:outputLabel for="firstContactorPhoneNumber" value="第一联系人电话" />
					<p:inputText id="firstContactorPhoneNumber"
						value="#{serviceBuyerHome.instance.firstContactorPhoneNumber}"
						required="true" />
					<p:outputLabel for="secondContactor" value="第二联系人" />
					<p:inputText id="secondContactor"
						value="#{serviceBuyerHome.instance.secondContactor}" />
					<p:outputLabel for="secondContactorPhoneNumber" value="第二联系人电话" />
					<p:inputText id="secondContactorPhoneNumber"
						value="#{serviceBuyerHome.instance.secondContactorPhoneNumber}" />

					<p:outputLabel for="buyerType" value="用户类型" />
					<p:selectOneMenu id="buyerType"
						value="#{serviceBuyerHome.instance.buyerType}" required="true">
						<f:selectItem itemLabel="请选择" itemValue="#{null}" />
						<f:selectItem itemLabel="个人" itemValue="个人" />
						<f:selectItem itemLabel="公司单位" itemValue="公司单位" />
					</p:selectOneMenu>
					<p:outputLabel for="address" value="地址" />
					<p:inputText id="address"
						value="#{serviceBuyerHome.instance.address}"
						styleClass="input-large" />
				</h:panelGrid>
			</p:panel>

			<p:commandButton action="#{serviceBuyerHome.saveAndFlush()}"
				value="保存" ajax="true" update="@form" />
			<p:commandButton action="#{serviceBuyerHome.cancel()}" value="取消"
				immediate="true"></p:commandButton>

		</h:form>
	</ui:define>

</ui:composition>
